< previous page page_298 next page >

Page 298
2. Add the following line of code to the end of the existing txtArray_LostFocus event procedure:
lblArray(Index).Font.Bold = False
3. Run the application. When you tab through the text boxes, notice that the associated Label control for the currently selected text box appears bold.
Creating a Menu Item Array
In addition to arrays of controls, you can also create an array of menu items. Like other control arrays, menu item arrays provide the only means to add items to the menu at runtime. You might use a menu item array to keep a list of the files most recently used by your program. This feature is found in many commercial programs.
To create a menu item array, you need to be in the Menu Editor (click the Menu Editor button or choose Tools, Menu Editor). You then create menu items by entering the Caption and Name properties of each item. When you create the menu item array, you also specify a value for the Index property of the item. Figure 13.5 shows the Menu Editor with these properties set for the first of what may be multiple menu items listing recently used files.
0298-01.jpg
Figure 13.5
You can set a Menu control's 
Index property in
the Menu Editor to create an array of Menu controls.
Like control arrays, the elements of a menu item array must meet certain requirements:
All elements must have the same value for the Name property.
All elements must be at the same indentation level in the menu.
All elements must be contiguous in the menu. If you need a separator bar in the menu, it must also be part of the array.
Each element of the menu array must have a unique index number.

 
< previous page page_298 next page >